package com.iotp.service.paste;

import com.iotp.dao.paste.PasteMapper;
import com.iotp.entity.paste.Paste;
import com.iotp.entity.paste.PasteWithBLOBs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("pasteService")
public class PasteServiceImpl implements PasteService {

    @Autowired
    private PasteMapper pasteMapper;

    @Override
    public Long add(PasteWithBLOBs paste) {
        this.pasteMapper.insert(paste);
        return paste.getId();
    }

    @Override
    public void update(PasteWithBLOBs paste) {
        this.pasteMapper.updateByPrimaryKeySelective(paste);
    }

    @Override
    public void delete(Long id) {
        this.pasteMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Paste queryById(Long id) {
        return this.pasteMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<PasteWithBLOBs> queryList(PasteWithBLOBs paste) {
        return this.pasteMapper.selectByCondition(paste);
    }
}
